﻿@model Nop.Web.Models.Customer.CustomerDownloadableProductsModel
@{
    Layout = "~/Views/Shared/_Root.cshtml";

    //title
    Html.AddTitleParts(T("PageTitle.Account").Text);
}
@using Nop.Web.Framework;
<div class="account-page">
    <div class="page-title">
        <h1>@T("Account.DownloadableProducts")</h1>
    </div>
    <div class="clear">
    </div>
    <div class="body">
        <div class="downloadable-products">
            @if (Model.Items.Count > 0)
            {
                <ul data-role="listview" data-inset="true" data-filter="false">
                    @foreach (var item in Model.Items)
                    {
                        <li>
                            <div class="item">
                                <div>
                                    @T("DownloadableProducts.Fields.Order"): <a class="link" href="@Url.RouteUrl("OrderDetails", new { orderId = @item.OrderId })">@item.OrderId</a>
                                </div>
                                <div>
                                    @T("DownloadableProducts.Fields.Date"): @item.CreatedOn.ToString("d")
                                </div>
                                <div>
                                    @T("DownloadableProducts.Fields.Product"): <a href="@Url.RouteUrl("Product", new { productId = item.ProductId, SeName = item.ProductSeName })" title="View details">@item.ProductName</a>
                                    @if (!String.IsNullOrEmpty(item.ProductAttributes))
                                    {
                                        <br />
                                        @Html.Raw(item.ProductAttributes)
                                    }
                                </div>
                                <div>
                                    @if (item.DownloadId > 0)
                                    {
                                        <div>
                                            <a data-ajax="false" class="link" href="@Url.Action("GetDownload", "Download", new { opvId = item.OrderProductVariantGuid })">@T("DownloadableProducts.Fields.Download")</a>
                                        </div>
                                    }
                                    else
                                    {
                                        <div>
                                            @T("DownloadableProducts.Fields.Download"): @T("DownloadableProducts.Fields.Download.NA")
                                        </div>
                                    }
                                    @if (item.LicenseId > 0)
                                    {
                                        <div>
                                            <a class="link" href="@Url.Action("GetLicense", "Download", new { opvId = item.OrderProductVariantGuid })">@T("DownloadableProducts.Fields.DownloadLicense")</a>
                                        </div>
                                    }
                                </div>
                            </div>
                        </li>
                    }
                </ul>
                    
            }
            else
            {
                @T("DownloadableProducts.NoItems")
            }
        </div>
    </div>
</div>
